package com.lyun.service.impl;

import com.lyun.pojo.User;
import com.lyun.service.HuanXinService;
import com.lyun.service.UserService;
import com.lyun.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;


@Service
public class HuanXinServiceImpl implements HuanXinService {

    @DubboReference
    private UserService userService;

    private final String DEFAULT_PASSWORD = "123456";
    private final String HX_HEADER = "hx-username";

    @Override
    public HuanXinUserVo findHuanXinUser(Long userId) {
        User user = userService.getById(userId);
        if (user == null) {
            return null;
        }
        return new HuanXinUserVo(HX_HEADER + user.getHeader(), DEFAULT_PASSWORD);
    }
}
